home *** CD-ROM | disk | FTP | other *** search
- Path: news.ottawa.istar.net!usenet
- From: Peter_Janes@cableshare.ccmail.compuserve.com (Peter Janes)
- Newsgroups: comp.sys.amiga.misc
- Subject: Re: AmigaOS 4.x features
- Date: Sun, 31 Mar 96 22:26:35 EDT
- Organization: Society for the Prevention of Cruelty to Amigas
- Message-ID: <5031.6664T1241T611@cableshare.ccmail.compuserve.com>
- References: <4j7ein$a6v@B1FF.mindspring.com> <4jc7g1$ipq@news.rhrz.uni-bonn.de>
- <4jfm8i$b5n@B1FF.mindspring.com> <4jgc6q$a61@reuter.cse.ogi.edu> <4jkg5j$dva@B1FF.mindspring.com>
- NNTP-Posting-Host: 204.191.69.43
- X-Newsreader: THOR 2.22 (Amiga;UUCP) *UNREGISTERED*
-
- On 30-Mar-96 18:29:55, Charlie Moody <chmood@photobooks.atdc.gatech.edu> wrote:
- > On 29 Mar 1996 09:57:46 GMT, Tony Leneis wrote:
- >: In article <4jfm8i$b5n@B1FF.mindspring.com>,
-
- > It may be *as* powerful, but not moreso (and what the heck is 'UNIX
- > globbing'?)
-
- UNIX globbing is another term for UNIX pattern matching, though don't ask
- me where the term came from. It's similar to, but not the same as,
- pattern matching via regular expressions (which seems to be what you're
- looking for). (Regular expressions are the most powerful form of pattern
- matching, assuming there's a regular pattern to what you're matching,
- which is what we're dealing with here. Apologies to math/CS majors for
- a recursive and somewhat imprecise definition, but it's been over a year
- since I even *thought* about this stuff.)
-
- >: >Not just '?' and '*', but also the bracketed ranging, a la 'mv
- >: >fred-[a-z].pgm ram:'.
-
- >: You can do that now. Have you ever *tried* it before? For example:
-
- > [3.1-specific example removed]
-
- AFAIK, it was *not* 3.1-specific, but works under V36+.... (Of course, I'm
- running on a V40 system, so I can't verify the V37 behaviour.)
-
- >: For example, "dir sys:(a|b|c|e)#?".
-
- > [additional references to documentation for more counter-intuitive,]
- > [anti-logical methods deleted]
-
- > dir sys:[a-e]*
-
- > Logical, simple, fast: elegant.
-
- And not a regular expression--that command, if interpreted correctly,
- would list *all* of the files on sys:. (The Kleene star represents 0 or
- more occurrences of the term preceding it.) The regexp form (taking into
- account [] vs () translation) would be
- dir sys:[a-e].*
-
- And it's not the same as the given example. Your command includes files
- beginning with D, as well. (BTW, your command works as desired under
- AmigaOS--in fact, I just did it.) Under globbing, the example would be
- dir sys:[a-c|e]*
- (which also works under AmigaOS).
-
- >: I'd certainly take the functionality of the # operator any day
- >: over the UNIX * operator (provided I've got a match-any-character operator
- >: to go with it.)
-
- > You'd gladly throw away the match-any-character option, provided you've
- > got a match-any-character option to replace it???
-
- There are other uses for #; most UN*X-style commands only do globbing, not
- regexp, in my experience, so you can't say 'rm ab*c' to remove 'abbc' but
- not 'abdc'. To do this under AmigaOS, 'del a#bc'.
-
- There are advantages and disadvantages to both regexps and AmigaOS pattern
- matching. I've had enough theoretical math and computer science to know what
- regular expressions can and can't do, and that they're often less than
- intuitive.
-
- In case it hasn't been mentioned, one of the reasons * isn't activated by
- default is that it was also chosen to refer to the console (and as the
- escape character). Assuming it is activated, doing 'dir *' won't give you
- a directory of all files, but will produce an error message. 'dir **' will
- work properly. The former behaviour is for compatibility reasons--how do
- you tell whether the user is referring to all files or to the console? The
- latter escapes the special meaning of '*-as-console' so that it's read as
- '*-as-pattern'. (Of course, that leads to why * was used as escape instead
- of \, and why \ can't be used to continue lines, and why ; is the comment
- character instead of the command separator, and why Ctrl-J is the command
- separator....)
-
- I was about to write that the biggest problem I've had using AmigaOS pattern
- matching is that parentheses can't be nested, but decided to try:
- list ram:(*i(p|t)*)
- on the following directory:
- Directory "ram:" on Sunday 31-Mar-96
- Disk.info 1179 ----rw-d Today 17:50:59
- Clipboards Dir ----rwed Today 17:50:40
- T Dir ----rwed Today 19:55:48
- 1 file - 2 directories - 7 blocks used
- As expected, it produces:
- Directory "ram:" on Sunday 31-Mar-96
- Clipboards Dir ----rwed Today 17:50:40
- 1 directory - 2 blocks used
- Similarly,
- list ram:(*i~(p|t)*)
- produces:
- Directory "ram:" on Sunday 31-Mar-96
- Disk.info 1179 ----rw-d Today 17:50:59
- 1 file - 3 blocks used
-
- The latter, using globbing, would be something like:
- list ram:*i~[a-o|q-s|u-z]*
-
- This was never meant to become an exhaustive list of globbing, regexp or
- AmigaOS pattern matching capabilities, although it seems to have done so. 8^)
- Suffice to say, they're different systems. I believe the Amiga's is more
- flexible, simply because it *includes* globbing syntax (including *, although
- it's not enabled by default), it includes a slightly modified regexp syntax
- (# for .), and it's easier to use, IMHO.
-
- Peter_Janes@cableshare.ccmail.compuserve.com | "And so, here we are, victims of
- Network Administrator/QA Specialist // | Mathematics." --Londo Mollari
- Cableshare Interactive Technology \X/ | *** SUPPORT CANADIAN MUSIC ***
- ex-Certified Amiga Developer -- URL coming soon....
-